<?php

namespace App\Console\Commands;

use App\Http\Model\Console\EnumModel;
use Illuminate\Console\Command;

class enum extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'job:enum';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '刷新枚举值记录表:城市、主体';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        /*监管账户列表*/
        $pfs = EnumModel::pfs();
        /*从最近七天获取的数据中刷新*/
        $createDate = date('Y-m-d', strtotime('-7 day'));
        foreach ($pfs as $val) {
            /*刷新城市信息*/
            EnumModel::city($val->id, $createDate);
            /*刷新主体信息*/
            EnumModel::ledgerSubject($val->id, $createDate);
            /*刷新班级数据*/
            EnumModel::className($val->id, $createDate);
        }

        return 0;
    }
}
